define(['jquery', 'underscore', 'core/event', 'components/backtop/1.0.0/backtop', 'core/auth'], function($, _) {
    'use strict';

    // ajax debug mode
    $.ajaxPrefilter(function(options) {
        if (window._global.online_debug === true && window._global.debug === true) {
            // options.data = $.param($.extend(originalOptions.data, { debug: true }));
            var url = options.url;
            if (url.indexOf('?') > 0) {
                var arr = url.split('?');
                var params = arr[1].split('&');
                params.push('debug=' + window._global.debug);
                url = arr[0] + '?' + params.join('&');
            } else {
                url += '?debug=' + window._global.debug;
            }
            options.url = url;
        }
    });

    $(function() {

        var win = window;
        var updateAsideHeight = function() {
            var winH = win.innerHeight;
            var aside = $('aside.sidebar');
            var asideH = winH - 66;

            aside.css({
                minHeight: asideH
            });
        };
        updateAsideHeight();

        var throttled = _.throttle(updateAsideHeight, 500);
        $(win).resize(throttled);

    });

    return $;
});
